package cn.crawler.app.web.modules.controllers.open;

import cn.crawler.framework.base.model.enums.BizExceptionEnum;
import cn.crawler.framework.util.Result;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.log.Log;
import org.nutz.log.Logs;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Ok;

import java.util.HashMap;
import java.util.Map;

@IocBean
@At("/open/message")
public class MessageController {
    private static final Log log = Logs.get();

    @At
    @Ok("json")
    @RequiresAuthentication
    public Object data() {
        BizExceptionEnum[] values = BizExceptionEnum.values();
        Map map = new HashMap<>();
        for (BizExceptionEnum bizExceptionEnum : values) {
            map.put(bizExceptionEnum.getCode(),bizExceptionEnum.getMsg());
        }
        return Result.success(map);
    }
}
